import main from "./DialogView"
import Vue from "vue"

var Message = Vue.extend(main)
const MessageConform = (obj) => {
    return new Promise((resolve, reject) => {
        const concelCallback = () => {
            reject()
            document.body.removeChild(msg.$el)
            // console.log("取消");
        }
        const confirmCallback = () => {
            resolve()
            document.body.removeChild(msg.$el)
            // console.log("确定");
        }
        var newObj = { ...obj, concelCallback, confirmCallback }
        // 调用构造器将传入的参数传入
        let msg = new Message({ data: newObj })
        // 将用构造器生成对象挂载
        msg.$mount()
        // 将dom元素插入到页面
        document.body.appendChild(msg.$el)
    })
}
export default MessageConform